fix: show confirm dialog on closing upload tab#59324
Conversation
564bbab to
c2e253b
Compare
There was a problem hiding this comment.
Thanks for the PR @mykh-hailo, let's discuss this
@susnux better to have this as a core uploader feature, no ?
Yes I think this should be part of the Uploader Vue component (but not of the uploader API class). |
|
@mykh-hailo we use a shared component for uploading. I think it should be a shared feature, so anyone using the upload component benefit from this ! 👍 |
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
c2e253b to
77ef618
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
This PR adds a beforeunload safeguard to prevent users from accidentally closing or navigating away from the page while uploads are still active.
A new upload guard service is introduced in
apps/files/src/services/UploadBeforeUnload.tsand registered in both:apps/files/src/main.ts(regular Files app)apps/files_sharing/src/init-public.ts(public sharing/file drop flow)When the uploader status is not idle (including uploading or paused), the browser is prompted with a warning that leaving the page will cancel ongoing uploads. The listener is registered only once to avoid duplicate handlers.
Checklist
3. to review, feature component)stable32)AI (if applicable)